package com.huawei.appmarket.service.store.awk.card;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewParent;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.RelativeLayout;
import com.huawei.appgallery.foundation.card.base.card.BaseDistCard;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appmarket.service.store.awk.bean.NormalMultipleLineVerticalCardBean;
import java.util.ArrayList;
import o.azb;
import o.cgz;
import o.chz;
import o.ebk;
import o.ewm.d;
import o.ewm.h;

public class NormalMultipleLineVerticalCard extends BaseMultipleLineVerticalCard {
    private ebk ॱˊ;

    public /* synthetic */ BaseDistCard ˎ() {
        return ᐝ();
    }

    public NormalMultipleLineVerticalCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        this.ॱˊ = new ebk();
        this.ॱˊ.ˎ(view);
        return super.ˏ(view);
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (this.ॱˊ != null && (cardBean instanceof NormalMultipleLineVerticalCardBean)) {
            this.ॱˊ.ˋ((NormalMultipleLineVerticalCardBean) cardBean);
            this.ॱˊ.ˊ(ˉ());
            this.ॱˊ.ˊ();
        }
    }

    protected void ˋ(int i) {
        super.ˋ(i);
        int size = ˋ().size();
        for (int i2 = 0; i2 < size; i2++) {
            BaseDistCard baseDistCard = (BaseDistCard) ˋ().get(i2);
            if (baseDistCard != null && (baseDistCard instanceof NormalMultipleLineVerticalItemCard)) {
                NormalMultipleLineVerticalItemCard normalMultipleLineVerticalItemCard = (NormalMultipleLineVerticalItemCard) baseDistCard;
                if (i2 < this.ॱॱ) {
                    ImageView ˈ = normalMultipleLineVerticalItemCard.ˈ();
                    ViewParent parent = ˈ.getParent();
                    if (parent instanceof LinearLayout) {
                        LayoutParams layoutParams = (LayoutParams) ˈ.getLayoutParams();
                        if (layoutParams != null) {
                            layoutParams.topMargin = (int) this.ʼॱ.getResources().getDimension(d.ˌॱ);
                            ˈ.setLayoutParams(layoutParams);
                        }
                    } else if (parent instanceof RelativeLayout) {
                        RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) ˈ.getLayoutParams();
                        if (layoutParams2 != null) {
                            layoutParams2.topMargin = (int) this.ʼॱ.getResources().getDimension(d.ˌॱ);
                            ˈ.setLayoutParams(layoutParams2);
                        }
                    }
                }
                if (this.ॱॱ == 1) {
                    normalMultipleLineVerticalItemCard.ॱ(azb.ˊ(this.ʼॱ));
                    normalMultipleLineVerticalItemCard.ˋ(azb.ˏ(this.ʼॱ));
                } else if (i2 % this.ॱॱ == 0) {
                    normalMultipleLineVerticalItemCard.ॱ(azb.ˊ(this.ʼॱ));
                    normalMultipleLineVerticalItemCard.ˋ((int) this.ʼॱ.getResources().getDimension(d.ˉॱ));
                } else if (i2 % this.ॱॱ == this.ॱॱ - 1) {
                    normalMultipleLineVerticalItemCard.ॱ((int) this.ʼॱ.getResources().getDimension(d.ˉॱ));
                    normalMultipleLineVerticalItemCard.ˋ(azb.ˏ(this.ʼॱ));
                } else {
                    normalMultipleLineVerticalItemCard.ॱ((int) this.ʼॱ.getResources().getDimension(d.ˉॱ));
                    normalMultipleLineVerticalItemCard.ˋ((int) this.ʼॱ.getResources().getDimension(d.ˉॱ));
                }
                normalMultipleLineVerticalItemCard.ᐝ();
            }
        }
    }

    public View ˊ() {
        return LayoutInflater.from(this.ʼॱ).inflate(h.ʽᐝ, null);
    }

    public NormalMultipleLineVerticalItemCard ᐝ() {
        return new NormalMultipleLineVerticalItemCard(this.ʼॱ);
    }

    public void ॱ(chz o_chz) {
        for (BaseDistCard ॱ : ˋ()) {
            ॱ.ॱ(o_chz);
        }
        super.ॱ(o_chz);
    }

    public ArrayList<String> ʼ() {
        if (this.ॱˊ == null) {
            return null;
        }
        return this.ॱˊ.ˋ();
    }
}
